using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Common;

namespace CMS.admin
{
    public partial class counterList : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Grd1.DataSource = BuildGrid();
                Grd1.DataBind();
            }
        }
        protected DataSet BuildGrid()
        {
            DataSet ds = DAL.GetDataSet("exec tblHitCounter_GetAll");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
                return ds;
            else
                return null;
        }

        protected void btnClose_Click(object sender, EventArgs e)
        {
            Response.Redirect("index.aspx");
        }
         #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        public void OnPageIndexChanged(object sender, ComponentArt.Web.UI.GridPageIndexChangedEventArgs args)
        {
            Grd1.CurrentPageIndex = args.NewIndex;
        }
        public void OnSortCommand(object sender, ComponentArt.Web.UI.GridSortCommandEventArgs args)
        {
            Grd1.Sort = args.SortExpression;
        }
        public void OnNeedRebind(object sender, System.EventArgs oArgs)
        {
            Grd1.DataBind();
        }
        public void OnNeedDataSource(object sender, EventArgs oArgs)
        {
            Grd1.DataSource = BuildGrid();
        }
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.Load += new System.EventHandler(this.Page_Load);
            Grd1.PageIndexChanged +=
             new ComponentArt.Web.UI.Grid.PageIndexChangedEventHandler
             (OnPageIndexChanged);
            Grd1.SortCommand +=
                new ComponentArt.Web.UI.Grid.SortCommandEventHandler
                (OnSortCommand);
            Grd1.NeedRebind +=
                new ComponentArt.Web.UI.Grid.NeedRebindEventHandler
                (OnNeedRebind);
            Grd1.NeedDataSource +=
                new ComponentArt.Web.UI.Grid.NeedDataSourceEventHandler
                (OnNeedDataSource);
        }
        #endregion
    }
}
